<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.hcz.entity.User"%>
<%@page import="com.hcz.util.Const"%>
<%@ page import="com.hcz.web.ValidateServlet"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>余额显示</title>
    <script type="text/javascript" src = "js/jquery.js"></script>
    <style type="text/css">
    	span{
    		color:red;
    	}
    </style>
  </head>
  
  <body>
  <div>Welcome!!</div>
	  <%
	  	User user = (User)session.getAttribute(Const.SESSION_USER);
	  	String result = request.getParameter("n");
	   %>
	   
	   <%
	   if("left".equals(result)){
	    %>
	  	账号的余额：<%=user.getMoney() %>
		  <div>
		  <a href = "main.jsp">返回</a>
		  </div>
	  	<%} %>
	  	
 	<%
 		if("save".equals(result)){
 	%>
 		<h3>请输入存款金额：</h3>
 		<form action="account.jspx?p=save" id = "myform">
 			<input type = "text" name = "saveMoney" id = "money"/><span id = "money_error"></span><br/>
 			<input type = "button" value ="提交"id = "btn"/>
 		</form>
 	 	<script type="text/javascript">
 	 		$(document).ready(function(){
 	 			$("#money").keydown(function(){
 	 				$("#money_error").html("");
 	 			});
 	 			$("#btn").click(function(){
 	 				var money = $("#money").val();
 	 				if(money < 0 || money == null){
 	 					$("#money").focus();
 	 					$("#money_error").html("输入的金额有误，不可以为负数：");
 	 					return ;
 	 				}
 	 				$("#myform").submit();
 	 			});
 	 		});
 	 	</script>
 	 	
 	 	
 	 	
 	 	
 	 	
 	 	
 	 	
 	<%} %>
  </body>
</html>
